package com.inspur.his.controller;

import com.github.pagehelper.PageHelper;
import com.inspur.his.pojo.Pay;

import com.inspur.his.service.PayService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

@Controller
public class PayController {
    @Autowired
    PayService payService;

    @RequestMapping("payListController")
    public String payList(HttpServletRequest request, Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        //获取页面提交来的查询条件
        String name = request.getParameter("name");
        String memberid = request.getParameter("memberid");
        //  点击用户管理左侧菜单进行默认无条件查询
        HashMap map = new HashMap();
        map.put("name", name);
        map.put("memberid", memberid);
        PageHelper.startPage(pn, 5);
        List<Pay> payList = payService.payList(map);
        PageInfo<Pay> pageInfo = new PageInfo<Pay>(payList, payList.size());
        model.addAttribute("payList", payList);
        model.addAttribute("pageInfo", pageInfo);
        model.addAttribute("name", name);
        model.addAttribute("memberid", memberid);
        return "fy/payList.jsp";
    }
}